#define  _CRT_SECURE_NO_WARNINGS
#include "SList.h"

void Test1()
{
	SListNode* phead = NULL;
	SListPushFront(&phead, 1);
	SListPushFront(&phead, 2);
	SListPushFront(&phead, 3);
	SListPushFront(&phead, 4);
	SListPushBack(&phead, 1);
	SListPushBack(&phead, 2);
	SListPushBack(&phead, 3);
	SListPushBack(&phead, 4);
	SListPrint(phead);
}
void Test2()
{
	SListNode* phead = NULL;
	for (int i = 0; i < 100; i++)
		SListPushFront(&phead, i);
	for (int i = 90; i < 110; i++)
	{
		if (SListFind(phead, i))
		{
			printf("1");
		}
		else
		{
			printf("0");
		}
	}
}
void Test3()
{
	SListNode* phead = NULL;
	for (int i = 0; i < 100; i++)
		SListPushFront(&phead, i);
	SListDestroy(&phead);
}
void Test4()
{
	SListNode* phead = NULL;
	for (int i = 0; i < 100; i++)
		SListPushFront(&phead, i);
	for (int i = 90; i < 110; i++)
	{
		SListNode* pos = SListFind(phead, i);
		if (pos)
		{
			SListPushPosBack(&phead, pos, i * 2);
			SListPushPosFront(&phead, pos, i * 2 + 1);
		}
	}
	SListPrint(phead);
	for (int i = 90; i < 110; i++)
	{
		SListNode* pos = SListFind(phead, i);
		if (pos)
		{
			SListPopPosBack(&phead, pos, i * 2);
			SListPopPos(&phead, pos, i * 2);
		}
	}
	SListPrint(phead);
}
int main()
{
	//Test1();
	//Test2();
	//Test3();
	Test4();
	return 0;
}